Removed redundant unwrap
authordebris <marek.kotewicz@gmail.com>
Sun, 30 Jul 2017 14:15:35 +0000 (16:15 +0200)
committerdebris <marek.kotewicz@gmail.com>
Sun, 30 Jul 2017 14:15:35 +0000 (16:15 +0200)
src/cargo/ops/cargo_read_manifest.rs

index 0750068851aebb933f45b95cc56bdf188c4d51b1..3cc736a2d63aec1367a4654aa19333f6776130b4 100644 (file)
@@ -62,10 +62,9 @@ pub fn read_packages(path: &Path, source_id: &SourceId, config: &Config)
     })?;
 
     if all_packages.is_empty() {
-        if errors.is_empty() {
-            Err(format!("Could not find Cargo.toml in `{}`", path.display()).into())
-        } else {
-            Err(errors.pop().unwrap())
+        match errors.pop() {
+            Some(err) => Err(err),
+            None => Err(format!("Could not find Cargo.toml in `{}`", path.display()).into()),
         }
     } else {
         Ok(all_packages.into_iter().map(|(_, v)| v).collect())